import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

//norm组件中关键指标列表1
const Main = {
	state:{
		mainPage:1
	},
	mutations: {
		//norm组件关键指标列表1的页数增加函数
		addMainPage (state) {
			state.mainPage++;
		},
		//norm组件关键指标列表1的页数减少函数
		reduceMainPage(state) {
			state.mainPage--;
		},
		//norm组件关键指标列表1的页数跳转刷新
		updateMainPage(state,msg) {
			state.mainPage = Number(msg);
		}
	}
}

//norm组件中关键指标列表2
const Month = {
	state: {
		monthPage:1
	},
	mutations: {
		//norm组件关键指标列表2的页数增加函数
		addMonthPage (state) {
			state.monthPage++;
		},
		//norm组件关键指标列表2的页数减少函数
		reduceMonthPage(state) {
			state.monthPage--;
		},
		//norm组件关键指标列表2的页数跳转刷新函数
		updateMonthPage(state,msg) {
			state.monthPage = Number(msg);
		}
	}
}

const Power = {
	state: {
		powerPage:1
	},
	mutations: {
			//norm组件配网指标列表1的页数增加函数
			addPowerPage (state) {
				state.powerPage++;
			},
			//norm组件配网指标列表1的页数减少函数
			reducePowerPage(state) {
				state.powerPage--;
			},
			//norm组件配网指标列表1的页数跳转刷新函数
			updatePowerPage(state,msg) {
				state.powerPage = Number(msg);
			}
	}
}

const Other = {
	state: {
		otherPage:1
	},
	mutations: {
		//norm组件配网指标列表2的页数增加函数
		addOtherPage (state) {
			state.otherPage++;
		},
		//norm组件配网指标列表2的页数减少函数
		reduceOtherPage(state) {
			state.otherPage--;
		},
		//norm组件配网指标列表2的页数跳转刷新函数
		updateOtherPage(state,msg) {
			state.otherPage = Number(msg);
		}
	}
}

const Publish = {
	state: {
		publishPage:1
	},
	mutations: {
		//risk组件风险发布的页数增加函数
		addPublishPage (state) {
			state.publishPage++;
		},
		//risk组件风险发布的页数减少函数
		reducePublishPage(state) {
			state.publishPage--;
		},
		//risk组件风险发布的页数跳转刷新函数
		updatePublishPage(state,msg) {
			state.publishPage = Number(msg);
		}
	}
}

const Homework = {
	state: {
		homeworkPage:1
	},
	mutations: {
		//risk组件作业风险的页数增加函数
		addHomeworkPage (state) {
			state.homeworkPage++;
		},
		//risk组件作业风险的页数减少函数
		reduceHomeworkPage(state) {
			state.homeworkPage--;
		},
		//risk组件作业风险的页数跳转刷新函数
		updateHomeworkPage(state,msg) {
			state.homeworkPage = Number(msg);
		}
	}
}




const Safe= {
  state: {
    salePublishPage:1
  },
  mutations: {
    //risk组件作业风险的页数增加函数
    addsalePublishPage (state) {
      state.salePublishPage++;
    },
    //risk组件作业风险的页数减少函数
    reduceSalePublishPage(state) {
      state.salePublishPage--;
    },
    //risk组件作业风险的页数跳转刷新函数
    updateSalePublishPage(state,msg) {
      state.salePublishPage = Number(msg);
    }
  }
}





const Defect= {
  state: {
    defectPublishPage:1
  },
  mutations: {
    //risk组件作业风险的页数增加函数
    addDefectPublishPage (state) {
      state.defectPublishPage++;
    },
    //risk组件作业风险的页数减少函数
    reduceDefectPublishPage(state) {
      state.defectPublishPage--;
    },
    //risk组件作业风险的页数跳转刷新函数
    updateDefectPublishPage(state,msg) {
      state.defectPublishPage = Number(msg);
    }
  }
}










const store = new Vuex.Store({
	modules: {
		MAIN     : Main,
		MONTH    : Month,
		POWER    : Power,
		OTHER    : Other,
		PUBLISH  : Publish,
		HOMEWORK : Homework,
    SALE     : Safe,
    DEFECT   :Defect
	}
})

export default store
